<script src="https://unpkg.com/marked@2.1.3/lib/marked.js"></script>
<script src="https://unpkg.com/lodash@4.17.21/lodash.min.js"></script>
<script type="module">
  import { createApp } from '../src'

  createApp({
    input: '# hello',
    get compiledMarkdown() {
      return marked(this.input)
    },
    update: _.debounce(function (e) {
      this.input = e.target.value
    }, 100)
  }).mount('#editor')
</script>

<div id="editor">
  <textarea class="input" :value="input" @input="update"></textarea>
  <div class="output" v-html="compiledMarkdown"></div>
</div>

<style>
  html,
  body,
  #editor {
    margin: 0;
    height: 100%;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #333;
  }

  #editor {
    display: flex;
  }

  .input,
  .output {
    width: 50%;
    box-sizing: border-box;
  }

  .input {
    border: none;
    border-right: 1px solid #ccc;
    resize: none;
    outline: none;
    background-color: #f6f6f6;
    font-size: 14px;
    font-family: 'Monaco', courier, monospace;
    padding: 20px;
  }

  .output {
    padding: 0 20px;
  }

  code {
    color: #f66;
  }
</style>
